package com.telsoft.business;

import java.sql.SQLException;
import java.util.List;

import com.telsoft.data.LibraryDAO;
import com.telsoft.entity.LibraryEntity;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class LibraryBusiness {

    public static List<LibraryEntity> getLibrary() throws SQLException {
        LibraryDAO dao = new LibraryDAO();
        return dao.getLibrary();
    }

    public static String getFileFromFileID(int file_id) {
        LibraryDAO lib = new LibraryDAO();
        try {
            return lib.getFileByFileID(file_id);
        } catch (FileNotFoundException ex) {
            Logger.getLogger(LibraryBusiness.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(LibraryBusiness.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }
}
